import React, { Component } from "react";
import { Tabs, Button, message } from "antd";
import Articles from "../Article/Articles";
import ArticlesMon from "../Article/ArticlesMon";
import DataStatistics from "../DataStatistics/DataStatistics";
import { judgeMonCode } from '@/utils/formatMonTextStyle.js'

const { TabPane } = Tabs;
class AllContent extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  goBack = () => {
    this.props.parentBack();
  };
  copyUrl = text => {
    message.success("复制成功，如果失败，请在地址栏内手动复制.");
  };
  render() {
    return (
      <div>
        <Tabs
          defaultActiveKey={this.props.tabKey}
          onChange={() => {}}
          tabBarExtraContent={
            <div>
              <Button onClick={this.goBack}>返回上一级</Button>
            </div>
          }
        >
          <TabPane tab="文章内容" key="1">
            {/* 显示 详情内容 */}
            {judgeMonCode(this.props.contentData.title) ?
              <ArticlesMon handleGoBack={this.goBack} detailsContent={this.props} />
            :
              <Articles handleGoBack={this.goBack} detailsContent={this.props} />
            }
            {/* <Articles handleGoBack={this.goBack} detailsContent={this.props} /> */}
          </TabPane>
          <TabPane tab="数据统计" key="2">
            <DataStatistics statisticalData={this.props.statisticalData} />
          </TabPane>
        </Tabs>
      </div>
    );
  }
}

export default AllContent;
